<cfcomponent extends="assets.calgrants.com.Base">

	<cfscript>
        import assets.calgrants.com.bo.FundSurvey2014;
	</cfscript>
	
	<cffunction name="get" access="public" output="false" returntype="assets.calgrants.com.bo.FundSurvey2014">
		<cfargument name="Fund_Survey_ID" type="numeric" required="true" />
		<cfscript>
			if (arguments.Fund_Survey_ID gt 0) {
				local.loadArgs = {};
				local.loadArgs.obj = new FundSurvey2014();
				StructAppend(local.loadArgs, QueryToStruct(read(argumentCollection = arguments))[1]);
				return load(argumentCollection = local.loadArgs);
			} else {
				return new FundSurvey2014();
			}
		</cfscript>
	</cffunction>
	
	<cffunction name="load" access="public" output="false" returntype="assets.calgrants.com.bo.FundSurvey2014">
		<cfargument name="obj" type="assets.calgrants.com.bo.FundSurvey2014" required="true" />
		<cfscript>
			local.obj = arguments.obj;
			if (IsDefined("arguments.Fund_Survey_ID")) {
				local.obj.setFund_Survey_ID(arguments.Fund_Survey_ID);
			}
			if (IsDefined("arguments.Program_Year")) {
				local.obj.setProgram_Year(arguments.Program_Year); 
			}
			if (IsDefined("arguments.Deleted")) {
				local.obj.setDeleted(arguments.Deleted); 
			}
			if (IsDefined("arguments.Fund_ID")) {
				local.obj.setFund_ID(arguments.Fund_ID); 
			}
			if (IsDefined("arguments.Organization_ID")) {
				local.obj.setOrganization_ID(arguments.Organization_ID); 
			}
			if (IsDefined("arguments.Submitted_By_ID")) {
				local.obj.setSubmitted_By_ID(arguments.Submitted_By_ID); 
			}
			if (IsDefined("arguments.q1_1")) {
				local.obj.setQ1_1(arguments.q1_1);
			}
			if (IsDefined("arguments.q1_2")) {
				local.obj.setQ1_2(arguments.q1_2);
			}
			if (IsDefined("arguments.q1_3")) {
				local.obj.setQ1_3(arguments.q1_3);
			}
			if (IsDefined("arguments.q1_4")) {
				local.obj.setQ1_4(arguments.q1_4);
			}
			if (IsDefined("arguments.q1_5")) {
				local.obj.setQ1_5(arguments.q1_5);
			}
			if (IsDefined("arguments.q1_6")) {
				local.obj.setQ1_6(arguments.q1_6);
			}
			if (IsDefined("arguments.q2")) {
				local.obj.setQ2(arguments.q2);
			}
			if (IsDefined("arguments.q3_1")) {
				local.obj.setQ3_1(arguments.q3_1);
			}
			if (IsDefined("arguments.q3_2")) {
				local.obj.setQ3_2(arguments.q3_2);
			}
			if (IsDefined("arguments.q3_3")) {
				local.obj.setQ3_3(arguments.q3_3);
			}
			if (IsDefined("arguments.q3_4")) {
				local.obj.setQ3_4(arguments.q3_4);
			}
			if (IsDefined("arguments.q4")) {
				local.obj.setQ4(arguments.q4);
			}
			if (IsDefined("arguments.q4_Other")) {
				local.obj.setQ4_Other(arguments.q4_Other);
			}
			if (IsDefined("arguments.q5_1")) {
				local.obj.setQ5_1(arguments.q5_1);
			}
			if (IsDefined("arguments.q5_2")) {
				local.obj.setQ5_2(arguments.q5_2);
			}
			if (IsDefined("arguments.q5_3")) {
				local.obj.setQ5_3(arguments.q5_3);
			}
			if (IsDefined("arguments.q5_4")) {
				local.obj.setQ5_4(arguments.q5_4);
			}
			if (IsDefined("arguments.q6")) {
				local.obj.setQ6(arguments.q6);
			}
			if (IsDefined("arguments.q7")) {
				local.obj.setQ7(arguments.q7);
			}
			if (IsDefined("arguments.q8")) {
				local.obj.setQ8(arguments.q8);
			}
			if (IsDefined("arguments.q8_Other")) {
				local.obj.setQ8_Other(arguments.q8_Other);
			}
			if (IsDefined("arguments.q9")) {
				local.obj.setQ9(arguments.q9);
			}
			if (IsDefined("arguments.q10")) {
				local.obj.setQ10(arguments.q10);
			}
			if (IsDefined("arguments.q11")) {
				local.obj.setQ11(arguments.q11);
			}
			if (IsDefined("arguments.q12")) {
				local.obj.setQ12(arguments.q12);
			}
			if (IsDefined("arguments.q13_1")) {
				local.obj.setQ13_1(arguments.q13_1);
			}
			if (IsDefined("arguments.q13_2")) {
				local.obj.setQ13_2(arguments.q13_2);
			}
			if (IsDefined("arguments.q13_3")) {
				local.obj.setQ13_3(arguments.q13_3);
			}
			if (IsDefined("arguments.q13_4")) {
				local.obj.setQ13_4(arguments.q13_4);
			}
			if (IsDefined("arguments.q14")) {
				local.obj.setQ14(arguments.q14);
			}
			if (IsDefined("arguments.q15")) {
				local.obj.setQ15(arguments.q15);
			}
			if (IsDefined("arguments.q16")) {
				local.obj.setQ16(arguments.q16);
			}
			if (IsDefined("arguments.q17")) {
				local.obj.setQ17(arguments.q17);
			}
			if (IsDefined("arguments.q18")) {
				local.obj.setQ18(arguments.q18);
			}
			if (IsDefined("arguments.q19")) {
				local.obj.setQ19(arguments.q19);
			}
			if (IsDefined("arguments.Date_Created")) {
				local.obj.setDate_Created(arguments.Date_Created);
			}			
			return local.obj;
		</cfscript>
	</cffunction>

	<cffunction name="read" access="public" output="false" returntype="any">
		<cfargument name="Fund_Survey_ID" required="false" default="" />
		<cfargument name="Program_Year" required="false" default="" />
		<cfargument name="Deleted" required="false" default="0" />
		<cfargument name="Fund_ID" required="false" default="" />
		<cfargument name="Organization_ID" required="false" default="" />
		<cfargument name="Submitted_By_ID" required="false" default="" />
		<cfargument name="q1_1" required="false" default="" />
		<cfargument name="q1_2" required="false" default="" />
		<cfargument name="q1_3" required="false" default="" />
		<cfargument name="q1_4" required="false" default="" />
		<cfargument name="q1_5" required="false" default="" />
		<cfargument name="q1_6" required="false" default="" />
		<cfargument name="q2" required="false" default="" />
		<cfargument name="q3_1" required="false" default="" />
		<cfargument name="q3_2" required="false" default="" />
		<cfargument name="q3_3" required="false" default="" />
		<cfargument name="q3_4" required="false" default="" />
		<cfargument name="q4" required="false" default="" />
		<cfargument name="q4_other" required="false" default="" />
		<cfargument name="q5_1" required="false" default="" />
		<cfargument name="q5_2" required="false" default="" />
		<cfargument name="q5_3" required="false" default="" />
		<cfargument name="q5_4" required="false" default="" />
		<cfargument name="q6" required="false" default="" />
		<cfargument name="q7" required="false" default="" />
		<cfargument name="q8" required="false" default="" />
		<cfargument name="q8_other" required="false" default="" />
		<cfargument name="q9" required="false" default="" />
		<cfargument name="q10" required="false" default="" />
		<cfargument name="q11" required="false" default="" />
		<cfargument name="q12" required="false" default="" />
		<cfargument name="q13_1" required="false" default="" />
		<cfargument name="q13_2" required="false" default="" />
		<cfargument name="q13_3" required="false" default="" />
		<cfargument name="q13_4" required="false" default="" />
		<cfargument name="q14" required="false" default="" />
		<cfargument name="q15" required="false" default="" />
		<cfargument name="q16" required="false" default="" />
		<cfargument name="q17" required="false" default="" />
		<cfargument name="q18" required="false" default="" />
		<cfargument name="q19" required="false" default="" />
		<cfargument name="Date_Created" required="false" default="" />

		<cfset var recs = "">
		<cfstoredproc datasource="#getDatasource()#" procedure="readFundSurvey2014">
			<cfprocparam value="#arguments.Fund_Survey_ID#" cfsqltype="CF_SQL_INTEGER" null="#IIf(Len(Trim(arguments.Fund_Survey_ID)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.Program_Year#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.Program_Year)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.Deleted#" cfsqltype="CF_SQL_BIT" null="#IIf(Len(Trim(arguments.Deleted)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.Fund_ID#" cfsqltype="CF_SQL_INTEGER" null="#IIf(Len(Trim(arguments.Fund_ID)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.Organization_ID#" cfsqltype="CF_SQL_INTEGER" null="#IIf(Len(Trim(arguments.Organization_ID)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.Submitted_By_ID#" cfsqltype="CF_SQL_INTEGER" null="#IIf(Len(Trim(arguments.Submitted_By_ID)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q1_1#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q1_1)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q1_2#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q1_2)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q1_3#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q1_3)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q1_4#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q1_4)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q1_5#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q1_5)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q1_6#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q1_6)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q2#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q2)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q3_1#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q3_1)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q3_2#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q3_2)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q3_3#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q3_3)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q3_4#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q3_4)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q4#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q4)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q4_other#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q4_other)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q5_1#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q5_1)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q5_2#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q5_2)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q5_3#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q5_3)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q5_4#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q5_4)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q6#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q6)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q7#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q7)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q8#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q8)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q8_other#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q8_other)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q9#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q9)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q10#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q10)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q11#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q11)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q12#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q12)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q13_1#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q13_1)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q13_2#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q13_2)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q13_3#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q13_3)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q13_4#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q13_4)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q14#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q14)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q15#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q15)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q16#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q16)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q17#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q17)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q18#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q18)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.q19#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.q19)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.Date_Created#" cfsqltype="CF_SQL_TIMESTAMP" null="#IIf(Len(Trim(arguments.Date_Created)) eq 0, true, false)#" />
			<cfprocresult name="recs" />
		</cfstoredproc>
		<cfreturn recs />
	</cffunction>

	<cffunction name="save" access="public" output="false" returntype="any">
		<cfargument name="fund" required="true" type="assets.calgrants.com.bo.FundSurvey2014" />

		<cfstoredproc datasource="#getDatasource()#" procedure="saveFundSurvey2014">
			<cfprocparam value="#fund.getFund_Survey_ID()#" cfsqltype="CF_SQL_INTEGER" variable="id" type="inout" null="false" />
			<cfprocparam value="#fund.getProgram_Year()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
			<cfprocparam value="#fund.getDeleted()#" cfsqltype="CF_SQL_BIT" null="false" />
			<cfprocparam value="#fund.getFund_ID()#" cfsqltype="CF_SQL_INTEGER" null="false" />
			<cfprocparam value="#fund.getOrganization_ID()#" cfsqltype="CF_SQL_INTEGER" null="false" />
			<cfprocparam value="#fund.getSubmitted_By_ID()#" cfsqltype="CF_SQL_INTEGER" null="false" />
			<cfprocparam value="#fund.getQ1_1()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
			<cfprocparam value="#fund.getQ1_2()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
			<cfprocparam value="#fund.getQ1_3()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
			<cfprocparam value="#fund.getQ1_4()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
			<cfprocparam value="#fund.getQ1_5()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
			<cfprocparam value="#fund.getQ1_6()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
			<cfprocparam value="#fund.getQ2()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
			<cfprocparam value="#fund.getQ3_1()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
			<cfprocparam value="#fund.getQ3_2()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
			<cfprocparam value="#fund.getQ3_3()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
			<cfprocparam value="#fund.getQ3_4()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
			<cfprocparam value="#fund.getQ4()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
			<cfprocparam value="#fund.getQ4_Other()#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(fund.getQ4_Other())) eq 0, true, false)#" />
			<cfprocparam value="#fund.getQ5_1()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
			<cfprocparam value="#fund.getQ5_2()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
			<cfprocparam value="#fund.getQ5_3()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
			<cfprocparam value="#fund.getQ5_4()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
			<cfprocparam value="#fund.getQ6()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
			<cfprocparam value="#fund.getQ7()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
			<cfprocparam value="#fund.getQ8()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
			<cfprocparam value="#fund.getQ8_Other()#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(fund.getQ8_Other())) eq 0, true, false)#" />
			<cfprocparam value="#fund.getQ9()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
			<cfprocparam value="#fund.getQ10()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
			<cfprocparam value="#fund.getQ11()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
			<cfprocparam value="#fund.getQ12()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
			<cfprocparam value="#fund.getQ13_1()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
			<cfprocparam value="#fund.getQ13_2()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
			<cfprocparam value="#fund.getQ13_3()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
			<cfprocparam value="#fund.getQ13_4()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
			<cfprocparam value="#fund.getQ14()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
			<cfprocparam value="#fund.getQ15()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
			<cfprocparam value="#fund.getQ16()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
			<cfprocparam value="#fund.getQ17()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
			<cfprocparam value="#fund.getQ18()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
			<cfprocparam value="#fund.getQ19()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
		</cfstoredproc>
		<cfreturn id />
	</cffunction>

	<cffunction name="destroy" access="public" output="false" returntype="any">
		<cfargument name="Fund_Survey_ID" required="true" />

		<cfstoredproc datasource="#getDatasource()#" procedure="destroyFundSurvey2014">
			<cfprocparam value="#arguments.Fund_Survey_ID#" cfsqltype="CF_SQL_INTEGER" null="false" />
			<cfprocparam value="true" cfsqltype="CF_SQL_BIT" null="false" />
		</cfstoredproc>
		<cfreturn true />
	</cffunction>

</cfcomponent>

